package com.example.thread;

public class race implements Runnable{

    private String Winner;

    @Override
    public void run() {
        for (int i = 0;i<=100;i++)
        {
            System.out.println(Thread.currentThread().getName()+"跑了"+i+"米");
            if (i>=100)
            {
                System.out.println(Thread.currentThread().getName()+"赢了");
                break;
            }
        }
    }

    public static void main(String[] args) {
        race a =new race();
        new Thread(a,"兔子").start();
        new Thread(a,"乌龟").start();
    }
}
